package com.rainng.coursesystem.controller.admin;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.rainng.coursesystem.controller.BaseController;
import com.rainng.coursesystem.model.entity.TireInfoEntity;
import com.rainng.coursesystem.model.shitong.CheckFileVo;
import com.rainng.coursesystem.model.shitong.PdfFileCacheVo;
import com.rainng.coursesystem.model.vo.response.ResultVO;
import com.rainng.coursesystem.module.task.entity.Task;
import com.rainng.coursesystem.module.task.entity.TaskChange;
import com.rainng.coursesystem.module.task.entity.TaskChangeVo;
import com.rainng.coursesystem.service.CheckFileService;
import com.rainng.coursesystem.service.TireInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@Api(tags = "轮胎信息管理及变更扩展")
@RequestMapping("/v2/tire")
@RestController
public class TireInfoController extends BaseController {

    @Resource
    private TireInfoService service;

    //查
    @PostMapping("/page/count")
    @ApiOperation(value = "返回轮胎分页查询数量")
    public ResultVO listCount(@RequestBody TireInfoEntity tie) {
        return service.countTireInfo(tie);
    }

    @PostMapping("/page")
    @ApiOperation(value = "轮胎分页查询")
    public ResultVO listPage(@RequestBody TireInfoEntity tie) {

        List<Object> res = service.selectTireInfo(tie);
        return super.result(res);
    }

    @GetMapping("/guige")
    @ApiOperation(value = "轮胎规格信息")
    public ResultVO tireGuige(){
        return service.getTireGuige();
    }

    @PostMapping("/tirewidth")
    @ApiOperation(value = "轮胎断面宽度和静负荷半径")
    public ResultVO tireWidth(String info){
        return service.selectTireWidth(info);
    }

    @PostMapping("/savetask")
    @ApiOperation(value = "添加变更扩展")
    public ResultVO insertSaveTask(@RequestBody TaskChangeVo task){
        return service.editTaskChange(task);
    }

    @GetMapping("/gettask/{fapplyNum}")
    @ApiOperation(value = "变更扩展查询")
    public ResultVO getTaskChange(@PathVariable String fapplyNum){
        return service.selectTaskChange(fapplyNum);
    }

    @PostMapping("/updatetask")
    @ApiOperation(value = "编辑变更扩展")
    public ResultVO updateTaskChange(@RequestBody TaskChangeVo task){
        return service.updateTaskChange(task);
    }

    @PostMapping("/inserttask")
    @ApiOperation(value = "插入变更扩展信息")
    public ResultVO insertTaskChangeInfo(String taskType){return service.addTaskChangeInfo(taskType);}
}
